#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/* 病毒修改，入侵主机 */
int n, x;
int ans;
int main(){
    cin >> n >> x;
    vector<int> nums(n);
    for(int i=0;i<n;i++) cin >> nums[i];
    int l = nums[0]-x, r = nums[0] + x;
    for(int i=1;i<n;i++){
        if(nums[i]-x > r || nums[i] + x < l){
            l = nums[i]-x;
            r = nums[i]+x;
            ans++;
        }else{
            l = max(l, nums[i]-x);
            r = min(r, nums[i]+x);
        }
    }
    cout << ans << endl;
    return 0;
}

/*
input
5 4
4 9 6 7 8

output
0
*/